<%--
  Created by IntelliJ IDEA.
  User: Tolean
  Date: 2018/6/6
  Time: 17:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Lyon-Admin</title>
    <%@include file="common/head.jspf"%>
    <link rel="Shortcut Icon" href="${lyon}/static/images/favicon.ico"  />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="${lyon}/interface/admin/common/layui/css/font.css">
    <link rel="stylesheet" href="${lyon}/interface/admin/common/layui/css/xadmin.css">
    <script type="text/javascript" src="${lyon}/static/assets/js/jquery.min.js"></script>
    <script src="${lyon}/interface/admin/common/layui/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${lyon}/interface/admin/common/layui/js/xadmin.js"></script>
</head>
<body>
<div class="x-body">
    <form action="" method="post" class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label for="title" class="layui-form-label">
                <span class="x-red">*</span>图片标题
            </label>
            <div class="layui-input-inline">
                <input type="text" id="title" name="title"
                       value="${album.title}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="content" class="layui-form-label">
                <span class="x-red">*</span>图片描述
            </label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="content" name="content" class="layui-textarea"
                          >${album.content}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" lay-filter="update">保存修改</button>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;
        //监听提交
        form.on('submit(update)', function(data){
            var params=data.field;
            $.post("${lyon}/admin/updateAlbum.do?id="+${album.id},params,function (result) {
                if(result.success){
                    layer.alert("保存修改成功!", {icon: 1},function () {
                        window.parent.location.reload();
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                    });
                }else{
                    layer.msg("抱歉,保存修改失败!",{icon:2,time:1000});
                }
            },"json");
            return false;
        });
    });
</script>
</body>
</html>
